﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class UserControl_ucContactUs : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            EmailService emailSrv = new EmailService();
            string strMessage = txtMsg.Text.Trim();
            string strMessageCustomer = txtMsg.Text.Trim();

            //Send to specified department
            emailSrv.SendContactUsEmail(txtName.Text.Trim(),
                                        txtEmail.Text.Trim(),
                                        Global.CONTACT_EMAIL_ADDRESS,
                                        txtSubject.Text.Trim(),
                                        strMessageCustomer,
                                        Server.MapPath(Global.CONTACT_US));
            //Send thanking email to customer
            emailSrv.SendContactUsEmail(txtName.Text.Trim(),  
                                         "",
                                        txtEmail.Text.Trim(),
                                        txtSubject.Text.Trim(),
                                        strMessageCustomer,
                                        Server.MapPath(Global.CONTACT_US_THANK_YOU));
           // txtCaptcha.Text = String.Empty;

            lblMessage.Text = "You had send mail. Thank you !";
            lblMessage.ForeColor = System.Drawing.Color.Blue;
            lblMessage.Font.Bold = true;

            //pnlContactUs.Visible = false;
            txtName.Text =txtEmail.Text = txtSubject.Text = txtMsg.Text  = "";
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
            lblMessage.ForeColor = System.Drawing.Color.Red;
        }
    }
}
